// 函数写法

//简写
function fo(x:string,y:string):string{
    return x+y
}
let fuu = function (a:number,b:number):number{
    return a+b;
}

//完整写法
let fofu:(x:string,y:number)=>string=function(x:string,y:number):string{
    return x+y;
}

// 函数重载
// 函数名相同 函数当中传入的数据类型不同

/* function funfoo(x: string, y: string): string {
    return x + y
}

function funfoonum(x: number, y: number): number {
    return x + y
} */

/* function funfoostrnum(x: string | number, y: string | number){
    return x + y
}
 */

//函数声明重载
function funfoo1(x:string,y:string):string
function funfoo1(x:number,y:number):number

function funfoo1(x:string|number,y:string|number){
    if(typeof x==="string"&&typeof y==="string"){
        return x+y;
    }else if(typeof x==="number"&&typeof y==="number"){
        return x+y;
    }
}

console.log(funfoo1("打撒所","sadds"));
console.log(funfoo1(212,1212));

